#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;

#define in read()
#define pii pair<int,int>
#define fi first
#define se second
#define FILE(x) freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout);
#define pb push_back
#define ppi pair<int,pii>

int read(){
	int x = 0,sgn = 1;char ch = getchar();
	for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;
	for(;isdigit(ch);ch = getchar()) x = (x<<1)+(x<<3)+(ch^48);
	return x*sgn;
}

const int N = 3010;
const int E = 2e4+10;

int n,m,k,x,y,z,pre[E<<1],cnt=1,h[N];
set<pii> s[N];
bool vis[E<<1];
struct edge{int v,nxt;}e[E<<1];

void dfs(int x){if(pre[x]) dfs(pre[x]),printf(" %d",e[pre[x]].v);else printf("1");}

void link(int x,int y){e[++cnt] = (edge){y,h[x]};h[x] = cnt;}

int main (){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	n = in,m = in,k = in;
	for(int i = 1;i <= m;i++){
		x = in, y = in; link(x,y);link(y,x);
	}for(int i = 1;i <= k;i++){
		x = in, y = in,z = in;
		s[x].insert(pii(y,z));
	}
	queue<ppi> q;
	q.push(ppi(1,pii(0,0))); 
	while(q.size()){
		int x = q.front().fi,las = q.front().se.fi,tim = q.front().se.se; q.pop();
		for(int i = h[x];i;i = e[i].nxt){
			int y = e[i].v;
			if(s[e[las^1].v].find(pii(x,y)) != s[e[las^1].v].end() || vis[i]) continue;
			pre[i] = las; vis[i] = 1;
			q.push(ppi(y,pii(i,tim+1)));
			if(y == n){
				printf("%d\n",tim+1);
				dfs(i);printf(" %d",y);puts("");
				return 0;
			}
		}
	}puts("-1");
	return 0;
}

